import router from '@system.router';
import prompt from '@system.prompt';
export default {
    data: {
        title: 'World',
        backColor: '',
        backColorTow: "",
        backColorThree: "",
        backColorFour: "",
        backColorFive: "",
        whiteColor: "",
        whiteColorTow: "",
        whiteColorThree: "",
        whiteColorFour: "",
        whiteColorFive: "",
        valueData: '',
        degree:null,
        degreeNumdata:0,
        degreeNum:"",
        dataNum:null
    },

    handlerBack() {
        router.push(
            {
                uri:'pages/index/index',
                params: {
                    data1: this.degreeNum,
                },
            }
        );
    },
    onInit(){
        this.dataNum =this.data2
        this.degreeNum = this.dataNum
        },

    handlerBut() {
            let that = this
            if(that.degree == 0){
                that.degreeNumdata = 1

            }if(that.degree == 1){
                that.degreeNumdata = 5

            }if(that.degree == 2){
                that.degreeNumdata = 10

            }if(that.degree == 3){
                that.degreeNumdata = 15

            }if(that.degree == 4){
                that.degreeNumdata = 20

            }
            prompt.showDialog({
                title: '确定购买',
                message: `购买次数${that.degreeNumdata}次`,
                buttons: [
                    {
                        text: '确定',
                        color: '#666666',
                    },
//                    {
//                        text: '取消',
//                        color: '#666666',
//                    },

                ],
                success :function(data) {
                    console.log('--------------------------'+data.index)
                    that.degreeNum =that.dataNum +  that.degreeNumdata
                    that.handlerBack()


                },
//                cancel: function(data) {
//                    that.HanlderOk()
//                    console.log('--------------------------'+data.index)
////                    console.log('dialog cancel callback');
//
//                },

            });
    },
    HanlderOk(){
        console.log('退出界面')
    },
//    computed:{
//        degreeNum(){
//            return this.data2 +  this.degreeNumdata
//        }
//    },
    get(id) {
//        console.log(id)
        this.degree = id
//        console.log( this.degree)
        if (id == 0) {

            this.backColor = '#0a0'
            this.backColorTow = ''
            this.backColorThree = ''
            this.backColorFour = ''
            this.backColorFive = ''
            this.whiteColor = 'red'
            this.whiteColorTow = ''
            this.whiteColorThree = ''
            this.whiteColorFour = ''
            this.whiteColorFive = ''
        }
        if (id == 1) {
            this.backColor = ''
            this.backColorThree = ''
            this.backColorFour = ''
            this.backColorFive = ''
            this.backColorTow = '#0a0'
            this.whiteColorTow = 'red'
            this.whiteColor = ''
            this.whiteColorThree = ''
            this.whiteColorFour = ''
            this.whiteColorFive = ''
        }
        if (id == 2) {
            this.backColorThree = '#0a0'
            this.backColor = ''
            this.backColorFour = ''
            this.backColorFive = ''
            this.backColorTow = ''
            this.whiteColorThree = 'red'
            this.whiteColor = ''
            this.whiteColorTow = ''
            this.whiteColorFour = ''
            this.whiteColorFive = ''

        }
        if (id == 3) {
            this.backColorThree = ''
            this.backColor = ''
            this.backColorFour = '#0a0'
            this.backColorFive = ''
            this.backColorTow = ''
            this.whiteColor = ''
            this.whiteColorTow = ''
            this.whiteColorThree = ''
            this.whiteColorFour = 'red'
            this.whiteColorFive = ''
        }
        if (id == 4) {
            this.backColorThree = ''
            this.backColor = ''
            this.backColorFour = ''
            this.backColorFive = '#0a0'
            this.backColorTow = ''
            this.whiteColor = ''
            this.whiteColorTow = ''
            this.whiteColorThree = ''
            this.whiteColorFour = ''
            this.whiteColorFive = 'red'
        }
        if (id == 5) {
            this.backColorThree = ''
            this.backColor = ''
            this.backColorFour = ''
            this.backColorFive = ''
            this.backColorTow = ''
            this.whiteColor = ''
            this.whiteColorTow = ''
            this.whiteColorThree = ''
            this.whiteColorFour = ''
            this.whiteColorFive = ''
        }
    },
}
